﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Fuse8.ContentManagementFramework.Domain;
using Fuse8.ContentManagementFramework.Domain.Commands;
using Fuse8.DomainFramework.BusinessService;
using Fuse8.DomainFramework.Common;
using Fuse8.DomainFramework.Common.Locator;

namespace Fuse8.ContentManagementFramework.BizFacade.Services
{
    public class CmsContentTypeService : CmsSiteBusinessService<CmsContentType>
    {
        public IEnumerable<CmsContentType> FindAllNonSystem()
        {
            return Find(p => !p.IsSystemType);
        }

        public IEnumerable<CmsContentType> SelectAllSystem()
        {
            return Find(p => p.IsSystemType);
        }

        public override void Remove(CmsContentType entityObject)
        {
            Remove(entityObject.Id);
        }

        public override void Remove(int id)
        {
            var command = DependencyServiceLocator.Current.GetInstance<CmsContentTypeDeleteCommand>();
            command.Id = id;
            Execute(command);
        }

    }
}
